package com.onlinelibrary.controller;

import com.onlinelibrary.pojo.BookType;
import com.onlinelibrary.result.Result;
import com.onlinelibrary.service.BookTypeService;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;

@RequiredArgsConstructor
@RestController
@RequestMapping("/type")
public class TypeController {
    private final BookTypeService bookTypeService;

    @GetMapping("/list")
    Result list(){
        return bookTypeService.list();
    }

    @PostMapping("/addType")
    Result addType(@RequestBody BookType bookType){
        return bookTypeService.addType(bookType);
    }


    //deleteType
    @PostMapping("/deleteType")
    Result deleteType(@RequestBody BookType bookType){
        return bookTypeService.deleteType(bookType);
    }
}
